#include <iostream>
#include "ThreadPool.hpp"
#include "Log.hpp"
#include <string>
#include <memory>
#include<ctime>
using namespace std;
int main()
{
    srand(time(nullptr)^getpid()^pthread_self());
    // LogMessage(__FILE__, __LINE__, DEBUG, gIsSave,"helloworld");
    // LogMessage(__FILE__, __LINE__, DEBUG, gIsSave,"helloworld: %s","world");
    // LogMessage(__FILE__, __LINE__, DEBUG, gIsSave,"helloworld: %s,%d","world",10);
    // LogMessage(__FILE__, __LINE__, DEBUG, gIsSave,"helloworld: %s ,%d, %f","world",10,3.14);
        std::unique_ptr<ThreadPool<Task>> tp=std::make_unique<ThreadPool<Task>>(5);
      // std::unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>(5));
        tp->InitThreadPool();
        tp->Start();
       // sleep(5);
       int tasknum=10;
       
       while(tasknum--)
       {
        sleep(1);
        int a=rand()%10+1;
       usleep(1234);
       int b=rand()%20+2;
       Task t(a,b);
       LOG(INFO,"main thread push task : %s",t.DebugToString().c_str());
        tp->Enqueue(t);
       }
        tp->Stop();
        tp->Wait();
    return 0;
}